% TEST_ID: LANG-EXPAND-0129
% CATEGORY: language/string
% 测试 string 的提取

function test_string_strtok()
str = "A horse! A horse! My kingdom for a horse!";
token = strtok(str,'!');
ret = "A horse";
assert(isequal(token, ret));

chr = '     Four score and seven years ago';
token = strtok(chr);
assert(isequal(token, 'Four'));

str = ["all in good time";
       "my dog has fleas";
       "leave no stone unturned"];
[token,remain] = strtok(str);
ret1 = ["all"
    "my"
    "leave"];
ret2 = [" in good time"
    " dog has fleas"
    " no stone unturned"];
assert(isequal(token, ret1));
assert(isequal(remain, ret2));